//
// Created by 123 on 2025/1/13.
//
#include "vector"
#include "algorithm"
#include "iostream"
using namespace std;

class Greater4{
public:
    bool operator()(int val){
        return val >=4;
    }
};

void test1(){
    vector<int> v;
    v.push_back(1);
    v.push_back(2);
    v.push_back(4);
    v.push_back(3);
    v.push_back(4);
    int num = count_if(v.begin(),v.end(),Greater4());
    cout << num << endl;
}

class Person{
public:
    string name;
    int age;

public:
    Person(string name,int age){
        this->name = name;
        this->age = age;
    }
};

class AgeLess35{
public:
    bool operator()(const Person& p){
        return p.age < 35;
    }
};

void test2(){
    vector<Person> v;
    Person p1("1",35);
    Person p2("2",33);
    Person p3("3",36);
    Person p4("4",22);
    Person p5("5",18);
    v.push_back(p1);
    v.push_back(p2);
    v.push_back(p3);
    v.push_back(p4);
    v.push_back(p5);
    int num = count_if(v.begin(),v.end(),AgeLess35());
    cout << num << endl;

}

int main157(){
//    test1();
    test2();
    return 0;
}